package com.terry.keypass.common.data

import androidx.annotation.Keep
import androidx.datastore.core.Serializer
import com.terry.keypass.common.utils.CryptoManager
import com.terry.keypass.common.utils.UserSettingsSerializer
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.Serializable

const val DEFAULT_PASSWORD_LENGTH = 10f

@Keep
@Serializable
data class UserSettings(val keyPassPassword : String? = null ,
    val dbPassword : String? = null ,
    @Deprecated("Use passwordConfig instead") val defaultPasswordLength : Float = DEFAULT_PASSWORD_LENGTH ,
    val backupKey : String? = null ,
    val isBiometricEnable : Boolean = true , // 指纹默认打开
    val backupDirectory : String? = null ,
    val backupTime : Long? = null ,
    val autoBackupEnable : Boolean = false ,
    val overrideAutoBackup : Boolean = false ,
    val lastAppVersion : Int? = null ,
    val currentAppVersion : Int? = null ,
    val passwordConfig : PasswordConfig = PasswordConfig.Initial ,
    val passwordHint : String? = null ,
    val biometricLoginTimeoutEnable : Boolean? = null ,
    val lastPasswordLoginTime : Long? = null ,
    val lastKeyPhraseEnterTime : Long? = null) {
    fun isKeyPresent() = backupKey != null
}
